]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
polkit: Only unregister registered handles
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 22 Mar 2018 14:11:38 +0000 (11:11 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 6 Nov 2018 15:05:29 +0000 (13:05 -0200)
If the initialization fails for some reason, for example by
running 'gnome-shell --replace', we should not crash because
of an attempt of unregistering an unregistered agent handle.

Fix that by checking if the handle is not NULL before calling
the unregistering routines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66

src/shell-polkit-authentication-agent.c

index fd6c7913b77710afd2513108dfa754d16d76ce3f..bca967fa1beaf9377fa4ffd1f08b049d6f5542f9 100644 (file)
@@ -318,8 +318,11 @@ shell_polkit_authentication_agent_unregister (ShellPolkitAuthenticationAgent *ag
   if (agent->current_request != NULL)
     auth_request_dismiss (agent->current_request);
 
-  polkit_agent_listener_unregister (agent->handle);
-  agent->handle = NULL;
+  if (agent->handle)
+    {
+      polkit_agent_listener_unregister (agent->handle);
+      agent->handle = NULL;
+    }
 }
 
 static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);